package com.situ.stmall.controller.api;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.situ.stmall.entity.User;
import com.situ.stmall.service.OrderService;

@RestController
@RequestMapping("/api/order")
public class APIOrderController {

	@Autowired
	private OrderService orderService;
	
	@PostMapping("/getList")
	public List getList(HttpSession session) {
		User user = (User) session.getAttribute("user");
		
		List orders = orderService.getByUserId(user.getId());
		
		return orders;
	}
}
